/*
 * @Author: XieQiu 雪球
 * @Date: 2021-05-25 14:17:03
 * @LastEditTime: 2022-01-12 11:14:45
 * @LastEditors: Please set LastEditors
 * @Description: 设施组管理接口
 */
// import xjaxios from "@/utils/request";
// import xjaxiosonline from "@/utils/request-twoline";
import xjaxiosPoint from "@/utils/request";
import axios from "@/utils/request";

export default {
  /**
   * @description: 获取设施组列表 *代表必填
   * @param {String/Number} page *
   * @param {String/Number} size *
   * @param {Object} entity {componyId: 1} *
   * @param {String} order 排序方式 ASC DESC 默认ASC
   * @param {String} sort 自定义排序方式 'createTime'
   * @return {Array}
   */
  getLandGroupList(params) {
    params.entity = params.entity || {};
    params.entity.organizationNo = sessionStorage.organizationNo;
    return axios.post("/v3/facility/facilityGroup/queryPageByCondition", params);
  },
  /**
   * @description: 获取所有设施组
   * @param {String} organizationNo *
   * @return {Array}
   */
  getfacilityGroupAll(params) {
    return axios.post("/v3/facility/facilityGroup/queryByCondition", {
      // organizationNo: sessionStorage.organizationNo,
      groupStatus: false,
      ...params
    });
  },

  // 获取设施
  getqueryAllList() {
    return axios.get("/v3/facility/facility/queryAllFacilityDetail")
  },
  // TODO:
  getQueryAllLists() {
    return axios.get(`/v3/facility/facility/queryAllFacilityDetailByCondition?organizationNo=${sessionStorage.getItem('organizationNo')}&farmingTypeNo=${sessionStorage.getItem('farmingTypeNo')}`)
  },
  /**
   * @description: 新增设施组信息
   * @param {Object} formData *
   * @return {Object}
   */
  addLandFGroupInfo(formData) {
    formData.organizationNo = sessionStorage.organizationNo
    return axios.post("/v3/facility/facilityGroup/add", formData);
  },
  // addLandFGroupInfo(formData) {
  //   formData.organizationNo = sessionStorage.organizationNo;
  //   return axios.post("/facilityGroup/add", formData);
  // },

  /**
   * @description: 修改设施组信息
   * @param {Object} formData *
   * @return {Object}
   */
  editLandFGroupInfo(formData) {
    formData.organizationNo = sessionStorage.organizationNo
    return axios.post("/v3/facility/facilityGroup/edit", formData);
  },
  editStatus(formData) {
    return axios.post("/v3/facility/facilityGroup/editStatus", formData);
  },
  // editLandFGroupInfo(formData) {
  //   formData.organizationNo = sessionStorage.organizationNo;
  //   return axios.post("/facilityGroup/edit", formData);
  // },
  /**
   * @description: 批量删除设施组信息
   * @param {Array} list *
   * @return {Object}
   */
  delLandFGroupInfo(no) {
    return axios.get(`/v3/facility/facilityGroup/delByNo?no=${no}`);
  },
  delListLandFGroupInfo(list) {
    return axios.post("/v3/facility/facilityGroup/delListByNo", {
      noList: list
    });
  },

  /**
   * @description: 主键查询设施组信息
   * @param {String} facilityId *
   * @return {Object}
   */
  queryFacilityGroup(no) {
    return axios.get(`/v3/facility/facilityGroup/queryFacilityDetailsByGroupNo?no=${no}`);
  },

  /**
   * @description: 条件查询设施组信息
   * @param {String} organizationNo *
   * @return {Object}
   */
  queryFacilityGroupByCondition(params) {
    return axios.post("facilityGroup/queryByCondition", {

    });
  },

  queryfacility(no) {
    return axios.get(`/v3/facility/facilityGroup/queryFacilityDetailsByGroupNo?no=${no}`);
  },
  /**
   * @description: 批量查询设施组信息
   * @param null *
   * @return {Array}
   */
  // queryFacilityGroupList() {
  //   return xjaxiosPoint.get("/facilityPoint/queryList");
  // },
  // queryFacilityGroupList() {
  //   return xjaxiosPoint.post("/facilityGroup/queryAllByOrgIdList", {
  //     organizationNo: sessionStorage.organizationNo
  //   });
  // },
  queryFacilityGroupList() {
    return xjaxiosPoint.post("/facilityGroup/queryByCondition", {
      organizationNo: sessionStorage.organizationNo
    });
  },
  queryFacilityPointList() {
    return xjaxiosPoint.post("/facilityPoint/queryByCondition", {
      organizationNo: sessionStorage.organizationNo
    });
  },

  // 通过地块组编号查询所属得地块
  getdikuaiGroup(no) {
    return axios.get(`/v3/facility/facilityGroup/queryFacilityListByGroupNo?no=${no}`)
  }
};
